package com.cqc.jdk8.Jutil.concurrent.threadPoolExecutor.exception;

import org.junit.Test;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.TimeUnit;

/**
 * @author cui
 * @date 2023/11/10 22:21
 * @description
 **/
public class ThreadPoolTest {


    public static void main(String[] args) {
        TimeThreadPoolExecutor executor = new TimeThreadPoolExecutor(
                2,
                3,
                60,
                TimeUnit.SECONDS,
                new ArrayBlockingQueue<>(10)
        );

        executor.execute(new Task2());
        executor.submit(new Task2());
        executor.shutdown();
    }

    /**
     * 放在@Test中无效
     */
    @Test
    public void f1() {
        TimeThreadPoolExecutor executor = new TimeThreadPoolExecutor(
                2,
                3,
                0,
                TimeUnit.MILLISECONDS,
                new ArrayBlockingQueue<>(10)
        );

        executor.execute(new Task2());
        executor.submit(new Task2());
        executor.shutdown();
    }


}
